package com.xgit.iov.common.core.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;


@Data
public class BaseEntity<T extends Model<?>> extends Model<T> implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 编号
     */
	@ApiModelProperty(hidden = true)
    @TableId(value="id",type= IdType.ASSIGN_ID)  //雪花算法  id生成策略
    @JsonSerialize(using= ToStringSerializer.class)
    private Long id;

	/**
	 * 当前用户
	 */
	@ApiModelProperty(hidden = true)
	protected IovUser currentUser;

    /**
     * 当前数据规则
     */

    /**
     * 自定义SQL（SQL标识，SQL内容）
     */
    @JsonIgnore
    @TableField(exist = false)
    protected transient String dataScope;

    /**
     * 删除标记（0：正常；1：删除；）
     */
    public static final String DEL_FLAG_NORMAL = "0";
    public static final String DEL_FLAG_DELETE = "1";


}
